#!/bin/bash

git pull
go build -o task_smart_home main.go

mv task_smart_home /home/www/smart_home/task/task_smart_home
cp -r ../conf /home/www/smart_home

supervisorctl stop task_smart_home

for pid in $(ps -ef | grep /home/www/smart_home/task/task_smart_home | grep -v grep | cut -c 15-20); do
    echo $pid
    kill -9 $pid
done

supervisorctl start task_smart_home
tail -f /usr/local/supervisor/logs/task_smart_home.log